﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Bdcs.Application.Mappers.Dto;
using Bdcs.Application.Services.IServices;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;

namespace Bdcs.Application.Controllers
{
    /// <summary>
    /// 车辆设备信息接口
    /// </summary>
    [ApiDescriptionSettings("车辆设备信息接口@1099")]
    public class DeviceController : IDynamicApiController
    {
        private readonly IDeviceService _deviceService;

        public DeviceController(IDeviceService deviceService)
        {
            _deviceService = deviceService;
        }

        /// <summary>
        /// 测试方法
        /// </summary>
        /// <returns></returns>
        public string GetHello()
        {
            return "Furion Hello";
        }

        /// <summary>
        /// 获取车辆信息列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task<PagedList<CarInfoOutput>> GetCarList(int pageIndex = 1, int pageSize = 10)
        {
            var car = await _deviceService.FindCarInfoPage(pageIndex, pageSize);
            return car.Adapt<PagedList<CarInfoOutput>>();
        }
    }
}
